from django.db import models

# Create your models here.


#用户表

class User(models.Model):

	#用户名
	username = models.CharField(max_length=200)
	#密码
	password = models.CharField(max_length=200)

	#声明表名
	class Meta:
		db_table = "user"


#商品表
class Goods(models.Model):

	name = models.CharField(max_length=200)
	img = models.CharField(max_length=200,null=True)
	price = models.IntegerField()
	count = models.IntegerField(default=0,null=True)
	order_id = models.IntegerField()

	class Meta:
		db_table = "goods"


#订单表
class Orders(models.Model):
    uid = models.ForeignKey(User,on_delete=models.CASCADE)
    gid = models.ForeignKey(Goods,on_delete=models.CASCADE)
    #订单日期
    c_time = models.CharField(max_length=200)
    #订单号
    order_num = models.CharField(max_length=200)
    price = models.IntegerField()
    
    class Meta:
        db_table = "orders"



#用户评论
class Comment(models.Model):

	content = models.CharField(max_length=200)
	uid = models.IntegerField()
	gid = models.IntegerField()

	class Meta:
		db_table = "comment"